(in-package :procemu)

(defclass mov (instruction)
  ((source :initarg :source)
   (destination :initarg :destination))
  (:documentation "Move the contents of one location to another"))

(defmethod print-object ((instruction mov) stream)
  (print-unreadable-object (instruction stream :type t)
    (with-slots (source destination) instruction
      (format stream "~A ~A"
	      (location-string destination)
	      (location-string source)))))

(defmethod perform ((instruction mov) (cpu cpu))
  (with-slots (source destination) instruction
    (setf (location cpu destination)
	  (location cpu source))))